From af07397aafc3711665ac2355210a93f8428330bb Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Tue, 15 Jul 2014 09:34:47 +0200 Subject: [PATCH] Add --destdir option to install.sh --- Makefile | 2 +- src/install.sh | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 1394aa268..b638664e4 100644 --- a/Makefile +++ b/Makefile @@ -135,7 +135,7 @@ $(PKGDIR)/lib/cargo/manifest.in: $(BIN_TARGETS) Makefile mv $(DISTDIR)/manifest-$(PKG_NAME).in $(PKGDIR)/lib/cargo/manifest.in install: $(PKGDIR)/lib/cargo/manifest.in - $(PKGDIR)/install.sh --prefix=$(PREFIX) + $(PKGDIR)/install.sh --prefix=$(PREFIX) --destdir=$(DESTDIR) # Setup phony tasks .PHONY: all clean distclean test test-unit test-integration libcargo style diff --git a/src/install.sh b/src/install.sh index 89b6e2117..206adfb27 100755 --- a/src/install.sh +++ b/src/install.sh @@ -278,12 +278,14 @@ VAL_OPTIONS="" CFG_LIBDIR_RELATIVE=lib flag uninstall "only uninstall from the installation prefix" +valopt destdir "" "set installation root" opt verify 1 "verify that the installed binaries run correctly" valopt prefix "/usr/local" "set installation prefix" # NB This isn't quite the same definition as in `configure`. # just using 'lib' instead of CFG_LIBDIR_RELATIVE -valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries" -valopt mandir "${CFG_PREFIX}/share/man" "install man pages in PATH" +valopt libdir "${CFG_DESTDIR}${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries" +valopt mandir "${CFG_DESTDIR}${CFG_PREFIX}/share/man" "install man pages in PATH" + if [ $HELP -eq 1 ] then @@ -402,7 +404,7 @@ need_ok "failed to create installed manifest" while read p; do # Decide the destination of the file - FILE_INSTALL_PATH="${CFG_PREFIX}/$p" + FILE_INSTALL_PATH="${CFG_DESTDIR}${CFG_PREFIX}/$p" if echo "$p" | grep "^lib/" > /dev/null then @@ -446,7 +448,7 @@ done < "${CFG_SRC_DIR}/${CFG_LIBDIR_RELATIVE}/cargo/manifest.in" if [ -z "${CFG_DISABLE_VERIFY}" ] then msg "verifying installed binaries are executable" - "${CFG_PREFIX}/bin/cargo" -h > /dev/null + "${CFG_DESTDIR}${CFG_PREFIX}/bin/cargo" -h > /dev/null if [ $? -ne 0 ] then ERR="can't execute installed rustc binary. " -- 2.30.2